package com.ruoyi.sale.mapper;

import java.util.List;
import java.util.Map;

import com.ruoyi.sale.domain.ErpGoodss;
import com.ruoyi.sale.domain.ErpOrder;
import com.ruoyi.sale.domain.WarehouseDept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 订单Mapper接口
 *
 * @author ruoyi
 * @date 2025-03-10
 */
@Mapper
public interface ErpOrderMapper
{
    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    public ErpOrder selectErpOrderById(int id);

    /**
     * 查询订单列表
     *
     * @param erpOrder 订单
     * @return 订单集合
     */
    public List<ErpOrder> selectErpOrderList(ErpOrder erpOrder);

    /**
     * 新增订单
     *
     * @param erpOrder 订单
     * @return 结果
     */
    public int insertErpOrder(ErpOrder erpOrder);

    /**
     * 修改订单
     *
     * @param erpOrder 订单
     * @return 结果
     */
    public int updateErpOrder(ErpOrder erpOrder);

    /**
     * 删除订单
     *
     * @param id 订单主键
     * @return 结果
     */
    public int deleteErpOrderById(int id);


    List<ErpGoodss> selectOrderGoodsByOrderId(Long orderId);

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteErpOrderByIds(int[] ids);


    List<WarehouseDept> selectWarehouseDeptList();

    public List<ErpGoodss> selectErpGoodsList(ErpGoodss erpGoodss);


    int reduceProductStock(@Param("productId") Long productId,
                           @Param("quantity") Integer quantity,
                           @Param("warehouseId") Long warehouseId);

    String selectMaxOrderSnByDate(String date);

    int insertOrderGoods(Map<String, Object> params);
    String selectWarehouseNameById(Long warehouseId);

    List<ErpOrder> selectAvailableOrderList(ErpOrder erpOrder);
}
